<!doctype html>
<html ng-app="role">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="icon" href="../img/config.png">
    <!-- styles -->
    <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../vendor/angular/angular-toastr-1.4.1.min.css">
    <link rel="stylesheet" type="text/css" media='all' href="../vendor/angular/loading-bar.min.css">
    <link rel="stylesheet" type="text/css" href="../styles/common-style.css">
    <link rel="stylesheet" type="text/css" href="../vendor/select2/select2.min.css">
    <title>权限管理</title>
</head>

<body>

<apollonav></apollonav>

<div class="container-fluid apollo-container">
    <section class="panel col-md-offset-1 col-md-10" ng-controller="NamespaceRoleController">
        <header class="panel-heading">
            <div class="row">
                <div class="col-md-7">
                    <h4 class="modal-title">权限管理<small>(AppId:<label ng-bind="pageContext.appId"></label> Namespace:<label ng-bind="pageContext.namespaceName"></label>)</small>
                    </h4>
                </div>
                <div class="col-md-5 text-right">
                    <a type="button" class="btn btn-info" data-dismiss="modal"
                            href="/config.html?#appid={{pageContext.appId}}">返回到项目首页
                    </a>
                </div>
            </div>
        </header>
        <div class="panel-body" ng-show="hasAssignUserPermission">
            <div class="row">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">修改权<br><small>(可以修改配置)</small></label>
                        <div class="col-sm-8">
                            <form class="form-inline" ng-submit="assignRoleToUser('ModifyNamespace')">
                                <div class="form-group">
                                    <apollouserselector apollo-id="modifyRoleWidgetId"></apollouserselector>
                                </div>
                                <button type="submit" class="btn btn-default" style="margin-left: 20px;" ng-disabled="modifyRoleSubmitBtnDisabled">添加</button>
                            </form>
                            <!-- Split button -->
                            <div class="item-container">

                                <div class="btn-group item-info" ng-repeat="user in rolesAssignedUsers.modifyRoleUsers">
                                    <button type="button" class="btn btn-default" ng-bind="user.userId"></button>
                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                            aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ModifyNamespace', user.userId)">
                                        <span class="glyphicon glyphicon-remove"></span>
                                    </button>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
                <hr>

                <div class="row" style="margin-top: 10px;">
                    <div class="form-horizontal">
                        <div class="col-sm-2 text-right">
                            <label class="control-label">发布权<br><small>(可以发布配置)</small></label>
                        </div>
                        <div class="col-sm-8">
                            <form class="form-inline" ng-submit="assignRoleToUser('ReleaseNamespace')">
                                <div class="form-group">
                                    <apollouserselector apollo-id="releaseRoleWidgetId"></apollouserselector>

                                </div>
                                <button type="submit" class="btn btn-default" style="margin-left: 20px;" ng-disabled="ReleaseRoleSubmitBtnDisabled">添加</button>
                            </form>
                            <!-- Split button -->
                            <div class="item-container">
                                <div class="btn-group item-info" ng-repeat="user in rolesAssignedUsers.releaseRoleUsers">
                                    <button type="button" class="btn btn-default" ng-bind="user.userId"></button>
                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                            aria-haspopup="true" aria-expanded="false" ng-click="removeUserRole('ReleaseNamespace', user.userId)">
                                        <span class="glyphicon glyphicon-remove"></span>
                                    </button>
                                </div>
                            </div>

                        </div>
                    </div>

                </div>

            </div>


        </div>
        <div class="panel-body text-center" ng-show="!hasAssignUserPermission">
            <h2>您没有权限哟!</h2>
        </div>

    </section>
</div>

<div ng-include="'../views/common/footer.html'"></div>

<!-- jquery.js -->
<script src="../vendor/jquery.min.js" type="text/javascript"></script>

<!--angular-->
<script src="../vendor/angular/angular.min.js"></script>
<script src="../vendor/angular/angular-resource.min.js"></script>
<script src="../vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="../vendor/angular/loading-bar.min.js"></script>


<!-- bootstrap.js -->
<script src="../vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>

<!--nicescroll-->
<script src="../vendor/jquery.nicescroll.min.js"></script>

<script src="../vendor/select2/select2.min.js" type="text/javascript"></script>

<!--biz-->
<!--must import-->
<script type="application/javascript" src="../scripts/app.js"></script>
<script type="application/javascript" src="../scripts/services/AppService.js"></script>
<script type="application/javascript" src="../scripts/services/EnvService.js"></script>
<script type="application/javascript" src="../scripts/services/UserService.js"></script>
<script type="application/javascript" src="../scripts/services/CommonService.js"></script>
<script type="application/javascript" src="../scripts/services/PermissionService.js"></script>

<script type="application/javascript" src="../scripts/AppUtils.js"></script>

<script type="application/javascript" src="../scripts/PageCommon.js"></script>
<script type="application/javascript" src="../scripts/directive/directive.js"></script>

<script type="application/javascript" src="../scripts/controller/role/NamespaceRoleController.js"></script>
</body>
</html>
